<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<head>
	<meta charset="utf-8" />
	<meta name="keywords" content="pinpin社保" />
	<meta name="description" content="pinpin社保" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="renderer" content="webkit" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
	<title>社保运营后台-用户现金券详情</title>
	<%@ include file="/WEB-INF/jsp/common/common.jsp" %>
</head>
<body>
	<div id="wrapper">
		<%@ include file="/WEB-INF/jsp/common/menu.jsp" %>
        <div id="page-wrapper">
        	<div class="row">
                <div class="col-lg-12">
                    <!-- 路径导航 -->
                    <ol class="breadcrumb">
				      <li>社保后台</li>
				      <li class="active">用户现金券详情</li>
				    </ol>
                </div>
            </div>
            <div class="row">
            	<div class="col-lg-12">
            		<div class="panel panel-default">
            			<div class="panel-body">
        			    	<div class="form-inline dt-bootstrap no-footer">
        			    		<!-- 表单查询 -->
        			    		<form action="" method="post" class="form-check" id="queryCouponUserForm">
	        			    		<div class="row">
	        			    			<div class="col-lg-12">
	        			    				<input type="text" class="form-control" name="coupon_id" placeholder="请输入现金卷ID" value="${couponUserQueryForm.coupon_id }">
	                                        <input type="text" class="form-control" name="coupon_code" placeholder="请输入现金券码" value="${couponUserQueryForm.coupon_code }">
	                                        <input type="text" class="form-control" name="phone" placeholder="请输入绑定手机号" value="${couponUserQueryForm.phone }">
	                                        <input type="text" class="form-control" name="create_from" placeholder="请输入领券来源名称" value="${couponUserQueryForm.create_from }">
	        			    			    <input type="text" class="form-control" name="recommend_code" placeholder="请输入分享链接码" value="${couponUserQueryForm.recommend_code }">
	        			    			    <input type="submit" id="queryBtn" class="btn btn-primary" value="查 询">
	        			    			    <button type="button" id="resetBtn" class="btn btn-primary">重置</button>
	        			    			</div>
	        			    		</div>
        			    		</form>
        			    		<hr />
        			    		<!-- 分页 -->
                                <div class="row">
        			    			<div class="col-lg-2">
        			    				<!-- TODO 这个导出根本就没用
        			    				<button type="button" id="exportBtn" class="btn btn-primary btn-sm">批量导出</button>
        			    				 -->
        			    			</div>
        			    			<div class="col-lg-10">
        			    				<jsp:include page="/WEB-INF/jsp/common/page.jsp">
        			    					<jsp:param name="formId" value="queryCouponUserForm"/>
        			    				</jsp:include>
        			    			</div>
        			    		</div>
        			    		<!-- 表格列表 -->
        			    		<div class="row">
        			    			<div class="col-lg-12">
        			    				<table class="table table-striped table-bordered table-hover no-footer" role="grid">
        			    					<thead>
        			    						<tr><th width="3%"><input id="couponuserid" type="checkbox" /></th>
                                                    <th width="6%">用户现金券编号</th>
                                                    <th width="4%">券ID</th>
                                                    <th width="6%">绑定手机号</th>
                                                    <th width="8%">用户现金券码</th>
                                                    <th width="5%">现金券金额</th>
                                                    <th width="6%">绑定用户ID</th>
                                                    <th width="9%">开始时间 至 截止时间</th>
                                                    <th width="6%">消费时间</th>
                                                    <th width="6%">用户名</th>
                                                    <th width="6%">订单号</th>
                                                    <th width="6%">订单总金额</th>
                                                    <th width="6%">领券渠道</th>
                                                    <th width="6%">分享链接码</th>
                                                    <th width="5%">使用状态</th>
                                                </tr>
        			    					</thead>
        			    					<tbody>
        			    					<c:choose>
        			    						<c:when test="${empty pageModel.recordList }">
        			    							没有找到相关记录啊
        			    						</c:when>
        			    						<c:otherwise>
													<c:forEach items="${pageModel.recordList }" var="couponuser">
		        			    					<tr role="row">
		        			    							<td><input type="checkbox" id="couponuserid_${couponuser.id }" name="uids"></td>
		                                                    <td>${couponuser.id }</td>
		                                                    <td>${couponuser.coupon_id }</td>
		                                                    <td>${couponuser.phone }</td>
		                                                    <td>${couponuser.coupon_code }</td>
		                                                    <td>${couponuser.coupon_price }</td>
		                                                    <td>${couponuser.user_id }</td>
		                                                    <td>
		                                                    	<fmt:formatDate value="${couponuser.create_time }" pattern="yyyy-MM-dd"></fmt:formatDate>
		                                                    	至
		                                                    	<fmt:formatDate value="${couponuser.end_time }" pattern="yyyy-MM-dd"></fmt:formatDate>
		                                                    </td>
		                                                    <td><fmt:formatDate value="${couponuser.consume_time }" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>
		                                                    <td>${couponuser.user_name }</td>
		                                                    <td>${couponuser.order_no }</td>
		                                                    <td>${couponuser.order_price }</td>
		                                                    <td>
		                                                    ${couponuser.channel_name }
		                                                    </td>
		                                                    <td>
		                                                    ${couponuser.recommend_code }
		                                                    </td>
		                                                    <td>
		                                                    <c:if test="${couponuser.status eq 1 }">未使用</c:if>
		                                                    <c:if test="${couponuser.status eq 2 }">已使用</c:if>
		                                                    </td>
		        			    						</tr>
		        			    					</c:forEach>
        			    						</c:otherwise>
        			    					</c:choose>
        			    					</tbody>
        			    				</table>
        			    			</div>
        			    		</div>
        			    		<hr />
        			    		<!-- 分页 -->
                                <div class="row">
        			    			<div class="col-lg-12">
        			    				<jsp:include page="/WEB-INF/jsp/common/page.jsp">
        			    					<jsp:param name="formId" value="queryCouponUserForm"/>
        			    				</jsp:include>
        			    			</div>
        			    		</div>
        			    	</div>
            			</div>
            		</div>
            	</div>
            </div>
        </div>
	</div>
	<!-- 批量导出 -->
	<form action="/sba/excel/exportcouponuser" id="exportuserForm">
	</form>
    
    <script language="javascript">
    $(function(){
    	//重置
    	$("#resetBtn").click(function(){
    		$("#queryCouponUserForm").find("input[type='text'],input[type='select']").val("");
    	});
    	
    	//批量导出
    	$("#exportBtn").click(function(){
			var url = "/sba/excel/exportcouponuser";
			var json = CollectData($("#queryCouponUserForm"));
			//TODO 改造支持分页导出，查询列表和导出列表应该逻辑一致
			//exportByCond(url, json);
			$("#exportuserForm").html("");
			var formHtml = "";
			if(json != null) {
				for(var key in json) {
					formHtml += '<input name="'+key+'" type="hidden" value="'+json[key]+'"/>';
				}
			}
			$("#exportuserForm").html(formHtml);
			$("#exportuserForm").submit();
		});
    });
    </script>
</body>
</html>
